#include <iostream>
#include <cstdio>

using namespace std;
using ll = long long;

ll gcd(ll x, ll y){
    // 使用辗转相除法
    return y == 0 ? x : gcd(y, x % y);
}
int main(){

    ll n , a;
    while (cin >> n >> a){

        for (int i = 0; i < n; i++){
            ll b; scanf("%lld", &b);
            if (a >= b) a += b;
            else a += gcd(a, b);

        }
            printf("%lld\n", a);

    }
    return 0;
}